package com.kzc.controller.car;

import com.kzc.base.ResponseWrapper;
import com.kzc.bean.CarBean;
import com.kzc.bean.UserBean;
import com.kzc.mapper.stock.StockMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/car")
public class AddCarController {


    @Autowired(required = false)
    StockMapper stockMapper;

    @PostMapping(value = "/addCar" ,consumes = "application/json")
    @ResponseBody
    public ResponseWrapper<String> addCar(@RequestBody CarBean carBean){

        ResponseWrapper<String> responseWrapper = new ResponseWrapper<>();

        //先查询数据库 获取到最大的ID
        int stockId = stockMapper.findByStockId();


//        int status = stockMapper.addStockCar(stockId+1,carBean.getBrandId(),
//                carBean.getBrandName(),
//                carBean.getCarId(),
//                carBean.getCarName(),
//                carBean.getShopId(),
//                carBean.getCarType(),
//                carBean.getCarColor(),
//                carBean.getCarPhoto(),
//                carBean.getPlateNumber(),
//                carBean.getCarCity(),
//                carBean.getCityCode());
//
//        if(status == 1){
//            responseWrapper.setStatus(200);
//            responseWrapper.setMessage("成功");
//        }else{
//            responseWrapper.setStatus(-1);
//            responseWrapper.setMessage("失败");
//        }


        return responseWrapper;
    }


}
